﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace Knights.Recursos
{
    class Plano : Modelo
    {
        private float ladoMitad;
        private Vector3 normal;

        public Plano(int lado, Vector3 normal)
        {
            ladoMitad = lado / 2;
            this.normal = normal;

            Inicializar();
        }

        public override void Inicializar()
        {
            vertices.Add(new VertexPositionNormalTexture(new Vector3(-ladoMitad, -ladoMitad, ladoMitad), normal, new Vector2(0, 1)));
            vertices.Add(new VertexPositionNormalTexture(new Vector3(-ladoMitad, -ladoMitad, -ladoMitad), normal, new Vector2(0, 0)));
            vertices.Add(new VertexPositionNormalTexture(new Vector3(ladoMitad, -ladoMitad, -ladoMitad), normal, new Vector2(1, 0)));

            vertices.Add(new VertexPositionNormalTexture(new Vector3(ladoMitad, -ladoMitad, -ladoMitad), normal, new Vector2(1, 0)));
            vertices.Add(new VertexPositionNormalTexture(new Vector3(ladoMitad, -ladoMitad, ladoMitad), normal, new Vector2(1, 1)));
            vertices.Add(new VertexPositionNormalTexture(new Vector3(-ladoMitad, -ladoMitad, ladoMitad), normal, new Vector2(0, 1)));

            base.Inicializar();
        }

        public int Lado
        {
            get { return (int)(ladoMitad * 2); }
        }
    }
}
